import {fixJson} from './fixJson';

describe('Unit  | coreHandlers | util | truncateJson | fixJson', () => {
  test.each([
    // Basic steps of object completion
    ['{', '{"~~":"~~"}'],
    ['{}', '{}'],
    ['{"', '{"~~":"~~"}'],
    ['{"a', '{"a~~":"~~"}'],
    ['{"aa', '{"aa~~":"~~"}'],
    ['{"aa"', '{"aa":"~~"}'],
    ['{"aa":', '{"aa":"~~"}'],
    ['{"aa":"', '{"aa":"~~"}'],
    ['{"aa":"b', '{"aa":"b~~"}'],
    ['{"aa":"bb', '{"aa":"bb~~"}'],
    ['{"aa":"bb"', '{"aa":"bb","~~":"~~"}'],
    ['{"aa":"bb"}', '{"aa":"bb"}'],

    // Basic steps of array completion
    ['[', '["~~"]'],
    ['[]', '[]'],
    ['["', '["~~"]'],
    ['["a', '["a~~"]'],
    ['["aa', '["aa~~"]'],
    ['["aa"', '["aa","~~"]'],
    ['["aa",', '["aa","~~"]'],
    ['["aa","', '["aa","~~"]'],
    ['["aa","b', '["aa","b~~"]'],
    ['["aa","bb', '["aa","bb~~"]'],
    ['["aa","bb"', '["aa","bb","~~"]'],
    ['["aa","bb"]', '["aa","bb"]'],

    // Nested object/arrays
    ['{"a":{"bb', '{"a":{"bb~~":"~~"}}'],
    ['{"a":["bb",["cc","d', '{"a":["bb",["cc","d~~"]]}'],

    // Handles special characters in strings
    ['{"a":"hel\\"lo', '{"a":"hel\\"lo~~"}'],
    ['{"a":["this is }{some][ thing', '{"a":["this is }{some][ thing~~"]}'],
    ['{"a:a', '{"a:a~~":"~~"}'],
    ['{"a:', '{"a:~~":"~~"}'],

    // Handles incomplete non-string values
    ['{"a":true', '{"a":true,"~~":"~~"}'],
    ['{"a":false', '{"a":false,"~~":"~~"}'],
    ['{"a":null', '{"a":null,"~~":"~~"}'],
    ['{"a":tr', '{"a":"~~"}'],
    ['{"a":1', '{"a":"~~"}'],
    ['{"a":12', '{"a":"~~"}'],
    ['[12', '["~~"]'],
    ['[true', '[true,"~~"]'],
    ['{"a":1', '{"a":"~~"}'],
    ['{"a":tr', '{"a":"~~"}'],
    ['{"a":true', '{"a":true,"~~":"~~"}'],

    // Handles whitespace
    ['{"a" : true', '{"a" : true,"~~":"~~"}'],
    ['{"a" : "aa', '{"a" : "aa~~"}'],
    ['[1, 2, "a ", ', '[1, 2, "a ","~~"]'],
    ['[1, 2, true ', '[1, 2, true ,"~~"]'],
    // Complex nested JSON
    [
      '{"aa":{"bb":"yes","cc":true},"xx":["aa",1,true',
      '{"aa":{"bb":"yes","cc":true},"xx":["aa",1,true,"~~"]}',
    ],
  ])('it works for %s', (json, expected) => {
    const actual = fixJson(json);
    expect(actual).toEqual(expected);
  });

  test.each(['1', '2'])('it works for fixture %s', fixture => {
    const input = fixtures[fixture as keyof typeof fixtures].incompleteJson.trim();
    const expected = fixtures[fixture as keyof typeof fixtures].completeJson.trim();

    const actual = fixJson(input);
    expect(actual).toEqual(expected);
  });
});

const fixtures = {
  '1': {
    incompleteJson: `[{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-04-28T20:30:27.149789Z","lastLogin":"2023-04-13T19:40:13.734339Z","has2fa":true,"lastActive":"2023-04-14T17:36:23.756369Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"manager","roleName":"Manager","orgRole":"manager","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-04-28T20:30:27.572480Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-08-24T13:30:01.719798Z","lastLogin":"2023-04-18T20:19:32.572869Z","has2fa":true,"lastActive":"2023-04-18T21:18:53.674493Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-08-24T13:30:02.620935Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-07-26T17:38:43.681246Z","lastLogin":"2023-04-18T20:54:31.433191Z","has2fa":true,"lastActive":"2023-04-18T21:11:15.027754Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"219db453b9ef4a47a6c071fc836752a8"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-07-26T17:38:44.185908Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-05-12T17:47:51.719114Z","lastLogin":"2022-12-20T23:26:24.301088Z","has2fa":true,"lastActive":"2023-01-03T23:40:16.202147Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-05-12T17:47:52.127039Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-08-08T16:44:23.558695Z","lastLogin":"2023-04-07T07:52:12.808207Z","has2fa":true,"lastActive":"2023-04-18T17:53:21.169085Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"4548fe09d6c949ecb027c70af1d1e8fd"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-08-10T11:13:06.618597Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2023-02-01T19:03:04.268258Z","lastLogin":"2023-04-11T17:41:59.073515Z","has2fa":true,"lastActive":"2023-04-17T23:10:34.614992Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2023-02-03T19:52:50.750648Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-09-19T20:21:02.168949Z","lastLogin":"2023-04-17T20:27:01.536887Z","has2fa":true,"lastActive":"2023-04-18T21:09:26.940838Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"9e67f1e04e184833b8b3bfa45beea7ea"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2023-01-05T15:31:45.227526Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sentry","snuba"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2021-08-10T13:59:05.267005Z","lastLogin":"2023-04-18T17:28:59.989484Z","has2fa":true,"lastActive":"2023-04-18T17:28:50.801466Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":"5b2c870c491841d0bc114c9df5bb6d2e"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-08-10T13:59:06.023687Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-08-05T22:12:41.902738Z","lastLogin":"2023-04-18T21:02:34.963627Z","has2fa":true,"lastActive":"2023-04-18T21:17:28.257879Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-09-16T18:05:51.667528Z","inviteStatus":"approved","inviterName":"richard.ma@sentry.io","orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-10-14T23:15:17.528252Z","lastLogin":"2023-03-31T20:53:37.291706Z","has2fa":false,"lastActive":"2023-04-18T20:12:14.438701Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-10-19T19:38:46.936422Z","inviteStatus":"approved","inviterName":"isabel.matwawana@sentry.io","orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-12-09T23:20:23.346432Z","lastLogin":"2022-12-09T23:20:23.765878Z","has2fa":false,"lastActive":"2022-12-23T02:01:40.052033Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-12-09T23:20:23.745693Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2018-02-26T23:57:43.766558Z","lastLogin":"2023-01-19T19:11:45.061167Z","has2fa":true,"lastActive":"2023-01-19T19:11:31.930426Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2018-02-26T16:04:56.738643Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-03-07T14:05:53.423324Z","lastLogin":"2023-04-18T07:29:18.311034Z","has2fa":true,"lastActive":"2023-04-18T16:17:56.241831Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"1836fd44387a413a917cf052523623cc"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-03-07T14:05:54.238336Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sdks-publish","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-02-07T14:25:08.448480Z","lastLogin":"2023-04-13T08:24:55.740046Z","has2fa":true,"lastActive":"2023-04-18T17:53:19.914958Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"835ade1ffa314f788b1e1015af13cacb"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-02-07T14:25:08.946588Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2017-11-15T09:07:16.014572Z","lastLogin":"2023-04-18T17:50:00.282464Z","has2fa":true,"lastActive":"2023-04-18T17:55:17.126066Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2017-11-15T09:07:16.036013Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance","snuba"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2019-02-08T21:51:46.074436Z","lastLogin":"2023-04-18T20:03:13.403607Z","has2fa":true,"lastActive":"2023-04-18T20:35:34.150539Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2019-02-08T21:51:46.795772Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-06-27T18:14:49.652095Z","lastLogin":"2023-04-18T18:26:07.379897Z","has2fa":true,"lastActive":"2023-04-18T21:22:08.385362Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"1fc882a55f7e43caad0069765a940d72"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-06-27T18:14:50.014771Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2019-10-01T12:26:22.368368Z","lastLogin":"2023-04-18T16:28:34.978170Z","has2fa":true,"lastActive":"2023-04-18T17:53:44.185207Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2019-10-01T12:26:22.971086Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sdks-publish","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.p`,
    completeJson: `[{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-04-28T20:30:27.149789Z","lastLogin":"2023-04-13T19:40:13.734339Z","has2fa":true,"lastActive":"2023-04-14T17:36:23.756369Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"manager","roleName":"Manager","orgRole":"manager","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-04-28T20:30:27.572480Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-08-24T13:30:01.719798Z","lastLogin":"2023-04-18T20:19:32.572869Z","has2fa":true,"lastActive":"2023-04-18T21:18:53.674493Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-08-24T13:30:02.620935Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-07-26T17:38:43.681246Z","lastLogin":"2023-04-18T20:54:31.433191Z","has2fa":true,"lastActive":"2023-04-18T21:11:15.027754Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"219db453b9ef4a47a6c071fc836752a8"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-07-26T17:38:44.185908Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-05-12T17:47:51.719114Z","lastLogin":"2022-12-20T23:26:24.301088Z","has2fa":true,"lastActive":"2023-01-03T23:40:16.202147Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-05-12T17:47:52.127039Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-08-08T16:44:23.558695Z","lastLogin":"2023-04-07T07:52:12.808207Z","has2fa":true,"lastActive":"2023-04-18T17:53:21.169085Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"4548fe09d6c949ecb027c70af1d1e8fd"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-08-10T11:13:06.618597Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2023-02-01T19:03:04.268258Z","lastLogin":"2023-04-11T17:41:59.073515Z","has2fa":true,"lastActive":"2023-04-17T23:10:34.614992Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2023-02-03T19:52:50.750648Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-09-19T20:21:02.168949Z","lastLogin":"2023-04-17T20:27:01.536887Z","has2fa":true,"lastActive":"2023-04-18T21:09:26.940838Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"9e67f1e04e184833b8b3bfa45beea7ea"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2023-01-05T15:31:45.227526Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sentry","snuba"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2021-08-10T13:59:05.267005Z","lastLogin":"2023-04-18T17:28:59.989484Z","has2fa":true,"lastActive":"2023-04-18T17:28:50.801466Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":"5b2c870c491841d0bc114c9df5bb6d2e"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2021-08-10T13:59:06.023687Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2021-08-05T22:12:41.902738Z","lastLogin":"2023-04-18T21:02:34.963627Z","has2fa":true,"lastActive":"2023-04-18T21:17:28.257879Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-09-16T18:05:51.667528Z","inviteStatus":"approved","inviterName":"richard.ma@sentry.io","orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-10-14T23:15:17.528252Z","lastLogin":"2023-03-31T20:53:37.291706Z","has2fa":false,"lastActive":"2023-04-18T20:12:14.438701Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-10-19T19:38:46.936422Z","inviteStatus":"approved","inviterName":"isabel.matwawana@sentry.io","orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-12-09T23:20:23.346432Z","lastLogin":"2022-12-09T23:20:23.765878Z","has2fa":false,"lastActive":"2022-12-23T02:01:40.052033Z","isSuperuser":false,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-12-09T23:20:23.745693Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2018-02-26T23:57:43.766558Z","lastLogin":"2023-01-19T19:11:45.061167Z","has2fa":true,"lastActive":"2023-01-19T19:11:31.930426Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":false,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2018-02-26T16:04:56.738643Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-03-07T14:05:53.423324Z","lastLogin":"2023-04-18T07:29:18.311034Z","has2fa":true,"lastActive":"2023-04-18T16:17:56.241831Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"1836fd44387a413a917cf052523623cc"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-03-07T14:05:54.238336Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sdks-publish","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2022-02-07T14:25:08.448480Z","lastLogin":"2023-04-13T08:24:55.740046Z","has2fa":true,"lastActive":"2023-04-18T17:53:19.914958Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"835ade1ffa314f788b1e1015af13cacb"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-02-07T14:25:08.946588Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sdks-publish","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2017-11-15T09:07:16.014572Z","lastLogin":"2023-04-18T17:50:00.282464Z","has2fa":true,"lastActive":"2023-04-18T17:55:17.126066Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2017-11-15T09:07:16.036013Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance","snuba"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2019-02-08T21:51:46.074436Z","lastLogin":"2023-04-18T20:03:13.403607Z","has2fa":true,"lastActive":"2023-04-18T20:35:34.150539Z","isSuperuser":true,"isStaff":true,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2019-02-08T21:51:46.795772Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":true,"isManaged":false,"dateJoined":"2022-06-27T18:14:49.652095Z","lastLogin":"2023-04-18T18:26:07.379897Z","has2fa":true,"lastActive":"2023-04-18T21:22:08.385362Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true},{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"upload","avatarUuid":"1fc882a55f7e43caad0069765a940d72"}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2022-06-27T18:14:50.014771Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["feedback","javascript","sentry","sentry-tests-acceptance"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.png","isActive":true,"hasPasswordAuth":false,"isManaged":false,"dateJoined":"2019-10-01T12:26:22.368368Z","lastLogin":"2023-04-18T16:28:34.978170Z","has2fa":true,"lastActive":"2023-04-18T17:53:44.185207Z","isSuperuser":true,"isStaff":false,"experiments":{},"emails":[{"id":"1234","email":"test-user-email@sentry.io","is_verified":true}],"avatar":{"avatarType":"letter_avatar","avatarUuid":null}},"role":"member","roleName":"Member","orgRole":"member","pending":false,"expired":false,"flags":{"idp:provisioned":false,"idp:role-restricted":false,"sso:linked":true,"sso:invalid":false,"member-limit:restricted":false},"dateCreated":"2019-10-01T12:26:22.971086Z","inviteStatus":"approved","inviterName":null,"orgRolesFromTeams":[],"projects":["javascript","sdks-publish","sentry"]},{"id":"1234","email":"test-user-email@sentry.io","name":"Sentry Test User","user":{"id":"1234","name":"Sentry Test User","username":"ABCD1234","email":"test-user-email@sentry.io","avatarUrl":"https://avatar-url.com/my-avatar.p~~"}}]`,
  },
  '2': {
    incompleteJson: `[
  {
    "id": "123456",
    "email": "test.user@sentry.io",
    "name": "test.user@sentry.io",
    "user": {
      "id": "123456",
      "name": "test.user@sentry.io",
      "username": "ABCDEF",
      "email": "test.user@sentry.io",
      "isActive": true
    },
    "role": "member",
    "roleName": "Member",
    "orgRole": "member",
    "pending": false,
    "expired": false,
    "dateCreated": "2021-09-24T13:30:02.620935Z",
    "inviteStatus": "approved",
    "inviterName": null,
    "orgRolesFromTeams": [],
    "projects": ["feedback", "javascript", "sentry", "sentry-tests-acceptance`,
    completeJson: `[
  {
    "id": "123456",
    "email": "test.user@sentry.io",
    "name": "test.user@sentry.io",
    "user": {
      "id": "123456",
      "name": "test.user@sentry.io",
      "username": "ABCDEF",
      "email": "test.user@sentry.io",
      "isActive": true
    },
    "role": "member",
    "roleName": "Member",
    "orgRole": "member",
    "pending": false,
    "expired": false,
    "dateCreated": "2021-09-24T13:30:02.620935Z",
    "inviteStatus": "approved",
    "inviterName": null,
    "orgRolesFromTeams": [],
    "projects": ["feedback", "javascript", "sentry", "sentry-tests-acceptance~~"]}]`,
  },
};
